﻿using System;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BlogEngine.SQLServer
{
    internal static class Extensions
    {
        internal static Dictionary<string, string> ToDictionary(this StringDictionary dictionary)
        {
            // hate StringDictionary. hate hate hate.
            Dictionary<string, string> dic = new Dictionary<string, string>();
            foreach (DictionaryEntry entry in dictionary)
            {
                dic.Add((string)entry.Key, (string)entry.Value);
            }
            return dic;
        }

        internal static StringDictionary ToStringDictionary(this Dictionary<string, string> dictionary)
        {
            StringDictionary dic = new StringDictionary();
            foreach (KeyValuePair<string, string> item in dictionary)
            {
                dic.Add(item.Key, item.Value);
            }
            return dic;
        }

        internal static List<string> ToList(this StringCollection strings)
        {
            List<string> l = new List<string>();
            foreach (string item in strings)
            {
                l.Add(item);
            }
            return l;
        }
    }
}
